<html>
<head><meta charset="utf-8"><title>BlockDefMap · t-compiler/rust-analyzer · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/index.html">t-compiler/rust-analyzer</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap.html">BlockDefMap</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="224369933"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap/near/224369933" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap.html#224369933">(Jan 28 2021 at 18:21)</a>:</h4>
<p>After <code>ItemTree</code>, I am happy to announce another hugely wasteful salsa query:</p>
<div class="codehilite"><pre><span></span><code>   223mb ItemTreeQuery
   167mb BlockDefMapQuery
</code></pre></div>



<a name="224372184"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap/near/224372184" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap.html#224372184">(Jan 28 2021 at 18:37)</a>:</h4>
<p>What are their relative counts? <code>RA_COUNT=1</code></p>



<a name="224372368"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap/near/224372368" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap.html#224372368">(Jan 28 2021 at 18:38)</a>:</h4>
<div class="codehilite"><pre><span></span><code>hir_def::item_tree::ItemTree            46_713       46_713       46_713
hir_def::nameres::DefMap                22_539       22_539       22_539
</code></pre></div>



<a name="224372694"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap/near/224372694" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap.html#224372694">(Jan 28 2021 at 18:40)</a>:</h4>
<p>and this only does the groundwork for inner items, nothing user-facing yet</p>



<a name="224372728"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap/near/224372728" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap.html#224372728">(Jan 28 2021 at 18:41)</a>:</h4>
<p>(this uses <code>block_def_map</code> during body lowering)</p>



<a name="224373119"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap/near/224373119" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap.html#224373119">(Jan 28 2021 at 18:44)</a>:</h4>
<p>ah, we don't get different counts for block vs non-block defmaps</p>
<p>But, there are about 600 def maps</p>



<a name="224373176"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap/near/224373176" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap.html#224373176">(Jan 28 2021 at 18:44)</a>:</h4>
<p>Why do we get so many block maps?</p>



<a name="224373209"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap/near/224373209" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap.html#224373209">(Jan 28 2021 at 18:45)</a>:</h4>
<p>because we compute one for <em>every single block</em> during body lowering now :D</p>



<a name="224373226"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap/near/224373226" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap.html#224373226">(Jan 28 2021 at 18:45)</a>:</h4>
<p>Like there are two oodles of magnitude...</p>



<a name="224373232"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap/near/224373232" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap.html#224373232">(Jan 28 2021 at 18:45)</a>:</h4>
<p>aaah</p>



<a name="224373278"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap/near/224373278" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap.html#224373278">(Jan 28 2021 at 18:45)</a>:</h4>
<p>yeah, that explains things )</p>



<a name="224373381"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap/near/224373381" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap.html#224373381">(Jan 28 2021 at 18:46)</a>:</h4>
<p>we really should create this only for interesting blocks</p>



<a name="224373535"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap/near/224373535" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap.html#224373535">(Jan 28 2021 at 18:47)</a>:</h4>
<p>yeah</p>



<a name="224373565"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap/near/224373565" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap.html#224373565">(Jan 28 2021 at 18:47)</a>:</h4>
<p>last time I tried that it broke macro resolution in weird ways</p>



<a name="224373607"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap/near/224373607" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap.html#224373607">(Jan 28 2021 at 18:47)</a>:</h4>
<p>I am somewhat surprised than this ends up smaller than item tree</p>



<a name="224719207"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap/near/224719207" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap.html#224719207">(Feb 01 2021 at 12:38)</a>:</h4>
<p>okay, after only computing the DefMap for blocks that actually contain inner items, this brings the size down to 39 MB, which still seems way too high, but much more reasonable</p>



<a name="224719240"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap/near/224719240" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap.html#224719240">(Feb 01 2021 at 12:38)</a>:</h4>
<p>I think we treat every macro in expression position as a potential item, which is wrong</p>



<a name="224719270"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap/near/224719270" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap.html#224719270">(Feb 01 2021 at 12:39)</a>:</h4>
<p>but we do have to treat every macro in statement position as a potential item, so that might explain the remaining memory</p>



<a name="224719587"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap/near/224719587" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap.html#224719587">(Feb 01 2021 at 12:43)</a>:</h4>
<p>I think we could check if the DefMap <em>after</em> nameres is empty and dispose of it</p>



<a name="224719758"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap/near/224719758" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap.html#224719758">(Feb 01 2021 at 12:44)</a>:</h4>
<p>A macro in expression position can expand to a block containing an item.</p>



<a name="224719813"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap/near/224719813" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap.html#224719813">(Feb 01 2021 at 12:45)</a>:</h4>
<p>yeah, that's fine</p>



<a name="224719832"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap/near/224719832" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap.html#224719832">(Feb 01 2021 at 12:45)</a>:</h4>
<p>it's contained in a different DefMap</p>



<a name="224720580"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap/near/224720580" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap.html#224720580">(Feb 01 2021 at 12:52)</a>:</h4>
<blockquote>
<p>but we do have to treat every macro in statement position as a potential item, so that might explain the remaining memory</p>
</blockquote>
<p>uh, this is less than ideal.... Makes sense to at least access how costly would it be to make this more lazy</p>



<a name="224720618"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap/near/224720618" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap.html#224720618">(Feb 01 2021 at 12:52)</a>:</h4>
<p><span class="user-mention silent" data-user-id="211727">Jonas Schievink</span> <a href="#narrow/stream/185405-t-compiler.2Fwg-rls-2.2E0/topic/BlockDefMap/near/224719587">said</a>:</p>
<blockquote>
<p>I think we could check if the DefMap <em>after</em> nameres is empty and dispose of it</p>
</blockquote>
<p>this doesn't seem to change memory usage</p>



<a name="224720682"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap/near/224720682" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap.html#224720682">(Feb 01 2021 at 12:53)</a>:</h4>
<p>this is already as lazy as body lowering fwiw</p>



<a name="224720760"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap/near/224720760" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap.html#224720760">(Feb 01 2021 at 12:54)</a>:</h4>
<p>Ah, right, that's for analysis stats, which looks into every body</p>



<a name="224720805"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap/near/224720805" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap.html#224720805">(Feb 01 2021 at 12:54)</a>:</h4>
<p>yeah</p>



<a name="224720811"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap/near/224720811" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap.html#224720811">(Feb 01 2021 at 12:54)</a>:</h4>
<p>so, its +39 in the inference phase, not the item map phaes. Then its ok I think</p>



<a name="224720867"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap/near/224720867" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap.html#224720867">(Feb 01 2021 at 12:55)</a>:</h4>
<p>mhmm, BodyQuery itself already uses 73 MB there, and inference data is another 49 MB</p>



<a name="224746034"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap/near/224746034" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap.html#224746034">(Feb 01 2021 at 15:54)</a>:</h4>
<p>welp, I broke macros :)</p>



<a name="224748768"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap/near/224748768" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap.html#224748768">(Feb 01 2021 at 16:08)</a>:</h4>
<p>hmm, I don't understand what's going on here. This code fails to resolve the macro:</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="fm">macro_rules!</span><span class="w"> </span><span class="n">m</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="p">()</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="p">{};</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">f</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="n">m</span><span class="o">!</span><span class="p">(</span><span class="n">a</span><span class="p">);</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>
<p>...but when I make this a body lowering test, the only diagnostic it emits is "leftover tokens", which is correct</p>



<a name="224748836"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap/near/224748836" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap.html#224748836">(Feb 01 2021 at 16:09)</a>:</h4>
<p>maybe it's a nameres problem</p>



<a name="224750891"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap/near/224750891" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Edwin Cheng <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap.html#224750891">(Feb 01 2021 at 16:22)</a>:</h4>
<p>Maybe <a href="https://github.com/rust-analyzer/rust-analyzer/blob/2d9bb69990b866bad0b4300972f1706d38329ad3/crates/hir_expand/src/db.rs#L380">https://github.com/rust-analyzer/rust-analyzer/blob/2d9bb69990b866bad0b4300972f1706d38329ad3/crates/hir_expand/src/db.rs#L380</a> ?</p>



<a name="224751016"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap/near/224751016" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap.html#224751016">(Feb 01 2021 at 16:22)</a>:</h4>
<p>hmm, what do you mean?</p>



<a name="224751204"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap/near/224751204" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Edwin Cheng <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap.html#224751204">(Feb 01 2021 at 16:23)</a>:</h4>
<p>I am not sure, but maybe it is used a wrong fragment kind to resolve the macro ?</p>



<a name="224751315"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap/near/224751315" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap.html#224751315">(Feb 01 2021 at 16:24)</a>:</h4>
<p>could that affect resolution of the macro?</p>



<a name="224751349"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap/near/224751349" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap.html#224751349">(Feb 01 2021 at 16:24)</a>:</h4>
<p>this started happening because of the changes for inner items</p>



<a name="224751487"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap/near/224751487" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Edwin Cheng <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap.html#224751487">(Feb 01 2021 at 16:25)</a>:</h4>
<blockquote>
<p>this started happening because of the changes for inner items</p>
</blockquote>
<p>Oh... nvm :)</p>



<a name="224756622"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap/near/224756622" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap.html#224756622">(Feb 01 2021 at 16:58)</a>:</h4>
<p>we seem to resolve an invocation like <code>name![x]</code> as <code>self::name</code></p>



<a name="224756731"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap/near/224756731" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap.html#224756731">(Feb 01 2021 at 16:59)</a>:</h4>
<p>this confused note I wrote down last week might be relevant:</p>
<blockquote>
<p><code>PathKind::Super(0)</code> resolves to the containing module, but for block modules, the containing module is also relevant</p>
</blockquote>



<a name="224756790"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap/near/224756790" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap.html#224756790">(Feb 01 2021 at 16:59)</a>:</h4>
<p>I think what I meant was that <code>Super(0)</code> resolves to the <em>current</em> module, but the containing one is relevant</p>



<a name="224756828"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap/near/224756828" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap.html#224756828">(Feb 01 2021 at 16:59)</a>:</h4>
<p>this does not explain why I can't manage to repro in a test though...</p>



<a name="224858379"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap/near/224858379" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap.html#224858379">(Feb 02 2021 at 11:26)</a>:</h4>
<p>This test takes <em>really</em> long in analysis-stats, presumably because of the macros: <a href="https://github.com/rust-lang/rust/blob/b814b639836aa76b5c6deaa585367150bb2debf4/library/std/src/net/ip/tests.rs#L464">https://github.com/rust-lang/rust/blob/b814b639836aa76b5c6deaa585367150bb2debf4/library/std/src/net/ip/tests.rs#L464</a></p>



<a name="224858643"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap/near/224858643" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap.html#224858643">(Feb 02 2021 at 11:29)</a>:</h4>
<p>I'm not sure why. I extracted that function to a new project and it's fast (more or less) there</p>



<a name="224858732"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap/near/224858732" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap.html#224858732">(Feb 02 2021 at 11:30)</a>:</h4>
<p>Ah, it's not because of block_def_map, it was always slow</p>



<a name="224858792"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap/near/224858792" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap.html#224858792">(Feb 02 2021 at 11:31)</a>:</h4>
<p>I thought it regressed because I remember testing when it was added to CI, but even on that commit it still seems slow and also crashes in <code>chalk</code></p>



<a name="224858869"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap/near/224858869" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap.html#224858869">(Feb 02 2021 at 11:32)</a>:</h4>
<p><a href="https://bpa.st/FJ7LK">https://bpa.st/FJ7LK</a> if you want to give that test a try</p>



<a name="224858889"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap/near/224858889" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap.html#224858889">(Feb 02 2021 at 11:32)</a>:</h4>
<p>And I think type inference is slow, not parsing</p>



<a name="224858973"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap/near/224858973" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap.html#224858973">(Feb 02 2021 at 11:33)</a>:</h4>
<p>yeah, that could also be it</p>



<a name="224912184"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap/near/224912184" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap.html#224912184">(Feb 02 2021 at 18:13)</a>:</h4>
<p><span class="user-mention silent" data-user-id="211727">Jonas Schievink</span> <a href="#narrow/stream/185405-t-compiler.2Fwg-rls-2.2E0/topic/BlockDefMap/near/224748768">said</a>:</p>
<blockquote>
<p>hmm, I don't understand what's going on here. This code fails to resolve the macro:</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="fm">macro_rules!</span><span class="w"> </span><span class="n">m</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="p">()</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="p">{};</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">f</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="n">m</span><span class="o">!</span><span class="p">(</span><span class="n">a</span><span class="p">);</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>
<p>...but when I make this a body lowering test, the only diagnostic it emits is "leftover tokens", which is correct</p>
</blockquote>
<p>Apparently this does <em>not</em> happen inside <code>lib.rs</code>, which would explain this behavior. Wow.</p>



<a name="224912462"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap/near/224912462" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap.html#224912462">(Feb 02 2021 at 18:15)</a>:</h4>
<p>This reproduces it inside a test:</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="c1">//- /lib.rs</span>
<span class="k">mod</span> <span class="nn">module</span><span class="p">;</span><span class="w"></span>

<span class="c1">//- /module.rs</span>
<span class="fm">macro_rules!</span><span class="w"> </span><span class="n">m</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="p">()</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="k">struct</span> <span class="nc">Def</span><span class="w"> </span><span class="p">{}</span><span class="w"></span>
<span class="w">    </span><span class="p">};</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">f</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="n">m</span><span class="o">!</span><span class="p">();</span><span class="w"></span>
<span class="w">        </span><span class="cp">$</span><span class="mi">0</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="224912589"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap/near/224912589" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap.html#224912589">(Feb 02 2021 at 18:16)</a>:</h4>
<p>oh I think I know why</p>



<a name="225717526"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap/near/225717526" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap.html#225717526">(Feb 09 2021 at 16:36)</a>:</h4>
<p>It is done.</p>
<p><a href="/user_uploads/4715/awUQt69nFW9jXbi2dOuV2XXV/Peek-2021-02-09-17-30.gif">Peek-2021-02-09-17-30.gif</a></p>
<div class="message_inline_image"><a href="/user_uploads/4715/awUQt69nFW9jXbi2dOuV2XXV/Peek-2021-02-09-17-30.gif" title="Peek-2021-02-09-17-30.gif"><img src="/user_uploads/4715/awUQt69nFW9jXbi2dOuV2XXV/Peek-2021-02-09-17-30.gif"></a></div>



<a name="225721714"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap/near/225721714" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap.html#225721714">(Feb 09 2021 at 17:03)</a>:</h4>
<p>Exciting!</p>



<a name="225721850"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap/near/225721850" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap.html#225721850">(Feb 09 2021 at 17:03)</a>:</h4>
<p>(don't forget to post this gif to the gifs issue, to have it ready for fhe next changelog)</p>



<a name="225721961"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap/near/225721961" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap.html#225721961">(Feb 09 2021 at 17:04)</a>:</h4>
<p>oh, does it matter where I post it?</p>



<a name="225722063"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap/near/225722063" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap.html#225722063">(Feb 09 2021 at 17:04)</a>:</h4>
<p>I posted a couple of them to the PRs, to keep them together. Probably not. The GIFs issue seems especially useful when there's no PR to post in.</p>



<a name="225723457"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap/near/225723457" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap.html#225723457">(Feb 09 2021 at 17:13)</a>:</h4>
<p>As long as it is somewhere where it's easy to find!</p>



<a name="225723619"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap/near/225723619" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap.html#225723619">(Feb 09 2021 at 17:14)</a>:</h4>
<p>Also .... are local import the last big language feature we were missing? Are we Rust-complete now (modulo bugs)?</p>



<a name="225723722"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap/near/225723722" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap.html#225723722">(Feb 09 2021 at 17:14)</a>:</h4>
<p>Ah, I guess we have attr-like proc macros left, and const-generics (</p>



<a name="225724070"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap/near/225724070" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap.html#225724070">(Feb 09 2021 at 17:16)</a>:</h4>
<p>macros in type position are still unsupported too</p>



<a name="225724098"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap/near/225724098" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap.html#225724098">(Feb 09 2021 at 17:17)</a>:</h4>
<p>and maybe in pattern position? not sure</p>



<a name="225724427"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap/near/225724427" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lukas Wirth <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap.html#225724427">(Feb 09 2021 at 17:19)</a>:</h4>
<p>Yes, pattern position macros aren't handled yet either</p>



<a name="225737080"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap/near/225737080" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap.html#225737080">(Feb 09 2021 at 18:43)</a>:</h4>
<p>hmm does this already work with name resolution in inference? if so, I'm a bit confused how</p>



<a name="225737176"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap/near/225737176" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap.html#225737176">(Feb 09 2021 at 18:43)</a>:</h4>
<p>or maybe it only works for the top-level block in a function</p>



<a name="225737208"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap/near/225737208" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap.html#225737208">(Feb 09 2021 at 18:43)</a>:</h4>
<p>probably that?</p>



<a name="225737296"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap/near/225737296" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap.html#225737296">(Feb 09 2021 at 18:44)</a>:</h4>
<p>(since inference currently just uses one resolver everywhere)</p>



<a name="225737537"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap/near/225737537" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap.html#225737537">(Feb 09 2021 at 18:45)</a>:</h4>
<p>Not always: <a href="https://github.com/rust-analyzer/rust-analyzer/pull/7614#issuecomment-776105995">https://github.com/rust-analyzer/rust-analyzer/pull/7614#issuecomment-776105995</a></p>



<a name="225738805"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap/near/225738805" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap.html#225738805">(Feb 09 2021 at 18:53)</a>:</h4>
<p><a href="https://github.com/rust-analyzer/rust-analyzer/blob/96a9ab725093b5f6501ed086973906ebb77805ff/crates/hir_def/src/nameres.rs#L363">This call</a> is also not yet resolved correctly, and there's a few other known bugs</p>



<a name="225738907"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap/near/225738907" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap.html#225738907">(Feb 09 2021 at 18:54)</a>:</h4>
<p>maybe that's what "name resolution in inference" would fix here</p>



<a name="225739106"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap/near/225739106" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap.html#225739106">(Feb 09 2021 at 18:56)</a>:</h4>
<p><a href="https://github.com/rust-analyzer/rust-analyzer/blob/96a9ab725093b5f6501ed086973906ebb77805ff/crates/hir_ty/src/infer/expr.rs#L330-L331">This</a> seems to use the right resolver though</p>



<a name="225739529"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap/near/225739529" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap.html#225739529">(Feb 09 2021 at 18:58)</a>:</h4>
<p>oh, right.<br>
probably something like</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">fn</span> <span class="nf">foo</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">struct</span> <span class="nc">S</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">field</span>: <span class="kt">u32</span> <span class="p">}</span><span class="w"></span>
<span class="w">    </span><span class="kd">let</span><span class="w"> </span><span class="n">s</span>: <span class="nc">S</span><span class="p">;</span><span class="w"></span>
<span class="w">    </span><span class="kd">let</span><span class="w"> </span><span class="n">f</span>: <span class="nc">s</span><span class="p">.</span><span class="n">field</span><span class="p">;</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>
<p>will not work correctly (infer the type of <code>f</code>) yet though, I expect?</p>



<a name="225739761"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap/near/225739761" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap.html#225739761">(Feb 09 2021 at 19:00)</a>:</h4>
<p>also getting traits in scope like Laurențiu's case. we'll have to review all usages of the <code>resolver</code> in <code>InferenceContext</code>, basically</p>



<a name="225740045"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap/near/225740045" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap.html#225740045">(Feb 09 2021 at 19:02)</a>:</h4>
<p>yeah, that doesn't infer the type yet</p>



<a name="225836792"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap/near/225836792" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap.html#225836792">(Feb 10 2021 at 13:42)</a>:</h4>
<p><span class="user-mention silent" data-user-id="129457">Florian Diebold</span> <a href="#narrow/stream/185405-t-compiler.2Fwg-rls-2.2E0/topic/BlockDefMap/near/225739529">said</a>:</p>
<blockquote>
<p>oh, right.<br>
probably something like</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">fn</span> <span class="nf">foo</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">struct</span> <span class="nc">S</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">field</span>: <span class="kt">u32</span> <span class="p">}</span><span class="w"></span>
<span class="w">    </span><span class="kd">let</span><span class="w"> </span><span class="n">s</span>: <span class="nc">S</span><span class="p">;</span><span class="w"></span>
<span class="w">    </span><span class="kd">let</span><span class="w"> </span><span class="n">f</span>: <span class="nc">s</span><span class="p">.</span><span class="n">field</span><span class="p">;</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>
<p>will not work correctly (infer the type of <code>f</code>) yet though, I expect?</p>
</blockquote>
<p>turns out this one's trivial to fix :)</p>



<a name="225837804"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap/near/225837804" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap.html#225837804">(Feb 10 2021 at 13:50)</a>:</h4>
<p>Opened <a href="https://github.com/rust-analyzer/rust-analyzer/pull/7627">https://github.com/rust-analyzer/rust-analyzer/pull/7627</a></p>



<a name="225838058"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap/near/225838058" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap.html#225838058">(Feb 10 2021 at 13:52)</a>:</h4>
<p>Wow, even the PR from yesterday apparently halved the number of unknown types in ripgrep</p>



<a name="225838096"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap/near/225838096" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap.html#225838096">(Feb 10 2021 at 13:52)</a>:</h4>
<p>(and doubled the type mismatches, but sssshhhhh)</p>



<a name="225838123"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap/near/225838123" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/BlockDefMap.html#225838123">(Feb 10 2021 at 13:53)</a>:</h4>
<p>progress!</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>